import os
from multiprocessing import Process


class MyProcess(Process):
    def __init__(self, name):
        super().__init__()
        self.name = name

    def run(self):
        print('子进程: {}'.format(os.getpid()))
        print('{} is chat with someone'.format(self.name))


if __name__ == '__main__':
    p1 = MyProcess('zhang1')
    p2 = MyProcess('zhang2')
    p3 = MyProcess('zhang3')
    p1.start()
    p2.start()
    p3.start()
    p1.join()
    p2.join()
    p3.join()


